package com.ruoyi.customer.service.impl;

import java.util.Collection;
import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.customer.mapper.ContractMapper;
import com.ruoyi.customer.domain.Contract;
import com.ruoyi.customer.service.IContractService;

/**
 * 合同信息Service业务层处理
 *
 * @author weixiao
 * @date 2022-11-28
 */
@Service
public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> implements IContractService {

    /**
     * 查询合同信息列表
     *
     * @param contract 合同信息
     * @return 合同信息
     */
    @Override
    public List<Contract> selectContractList(Contract contract) {
        return getBaseMapper().selectContractList(contract);
    }

    @Override
    public int updateNullifyState(Long[] ids) {
        return getBaseMapper().updateNullifyState(ids);
    }


    @Override
    public boolean save(Contract entity) {
        Date date = new Date();
        entity.setInputTime(date);

        String username = SecurityUtils.getUsername();
        entity.setInputUser(username);

        return super.save(entity);
    }

    @Override
    public boolean updateById(Contract entity) {
        Date date = new Date();
        entity.setInputTime(date);

        String username = SecurityUtils.getUsername();
        entity.setInputUser(username);

        return super.updateById(entity);
    }

}
